<%@page import="com.core.util.DspUtil"%>
<%@ page language="java" contentType="application/x-msdownload" import="java.net.*,java.io.*"%><%
String PathAndFileName = null;
String aFileName = null;
PathAndFileName = DspUtil.getDownloadsPath();
aFileName = request.getParameter("FName");
//PathAndFileName = "http://127.0.0.1:8080/trunk_green/downloads/0cf9b2c3-0aa3-4e20-aff1-5e4937c3e9d0.xls";
response.reset();
response.setContentType("application/x-download");
aFileName = URLEncoder.encode(aFileName,"GBK");
response.addHeader("Content-Disposition","attachment;filename=" + aFileName);
OutputStream output = null;
FileInputStream fis = null;
try
{
    output  = response.getOutputStream();
    fis = new FileInputStream(PathAndFileName + aFileName);

    byte[] b = new byte[1024];
    int i = 0;

    while((i = fis.read(b)) > 0)
    {
        output.write(b, 0, i);
    }
    output.flush();
}
catch(Exception e)
{
    System.out.println("WARN[File] : FileDown Throws Exception!");
    e.printStackTrace();
}
finally
{
    if(fis != null)
    {
        fis.close();
        fis = null;
    }
    if(output != null)
    {
        output.close();
        output = null;
    }
}
%>